package com.ld.controller;

import com.ld.service.FilmService;
import com.ld.service.FilmServiceImpl;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.Map;

@Controller
@RequestMapping("/filmController")
public class FilmController {
    @Resource(name = "filmService")
    private FilmService filmServiceImpl;

    /*
    @RequestMapping(value = "/queryAllFilm")
    public String queryAllFilm(ModelMap mm){
        mm.addAttribute("allFilm",filmServiceImpl.queryAllFilm());
        return "welcome";
    }
    */
    @PostMapping(value = "/queryAllFilm")
    @ResponseBody
    public Map<String,Object> queryAllFilm(
            @RequestParam("currentPage") int currentPage,
            @RequestParam("pageSize")int pageSize){

        Map<String, Object> filmMap = filmServiceImpl.queryAllFilm(currentPage, pageSize);
        return filmMap;
    }


}
